package cate.game.play.buff;


import cate.common.table.d.GDBuff;
import cate.common.util.XT;
import cate.game.play.buff.h.*;
import cate.game.play.config.buff.BuffCfg;
import cate.game.play.fighter.Fighter;
import easy.java.dev.note.NoteClass;
import lombok.extern.slf4j.Slf4j;


@NoteClass("buff工厂")
@Slf4j
public class BuffFactory {

    public Buff build(Fighter owner, Fighter caster, BuffCfg cfg, int roundAdd) {
        Buff buff = new Buff();
        buff.cfgSet(cfg).ownerSet(owner).casterSet(caster).roundAddSet(roundAdd).calcRoundRemove();
        buff.handlerSet(buildHandler(cfg));
        return buff;
    }

    /**
     *
     * @param cfg
     * @return
     */
    public BuffHandler buildHandler(BuffCfg cfg) {
        BuffHandler handler = createHandler(cfg.row.effectType);
        handler.parse(cfg.row.effectArgsCode);
        if (XT.isNotBlank(cfg.getExEffectArgs())) {
            for (String exCode : cfg.getExEffectArgs()) {
                handler.parseExt(exCode);
            }
        }
        return handler;
    }

    private BuffHandler createHandler(String effectType) {
        if (effectType == null) {
            return new 无效果BH();
        }
        switch (effectType) {
            case GDBuff.Type.眩晕:return new 眩晕BH();
            case GDBuff.Type.冰冻:return new 冰冻BH();
            case GDBuff.Type.嘲讽:return new 嘲讽BH();
            case GDBuff.Type.混乱:return new 混乱BH();
            case GDBuff.Type.免疫控制:return new 免疫控制BH();
            case GDBuff.Type.免疫指定buff:return new 免疫指定buffBH();
            case GDBuff.Type.免疫负面状态:return new 免疫负面状态BH();
            case GDBuff.Type.免疫技能伤害:return new 免疫技能伤害BH();
            case GDBuff.Type.免疫分摊伤害:return new 免疫分摊伤害BH();
            case GDBuff.Type.免疫驱散增益:return new 免疫驱散增益BH();

            case GDBuff.Type.伤害:return new 伤害BH();
            case GDBuff.Type.治疗:return new 治疗BH();
            case GDBuff.Type.护盾:return new 护盾BH();
            case GDBuff.Type.格挡盾:return new 格挡盾BH();
            case GDBuff.Type.反伤:return new 反伤BH();
            case GDBuff.Type.援护:return new 援护BH();
            case GDBuff.Type.诅咒:return new 诅咒BH();

            case GDBuff.Type.分摊伤害:return new 分摊伤害BH();
            case GDBuff.Type.技能吸血:return new 技能吸血BH();
            case GDBuff.Type.治疗溢出护盾:return new 治疗溢出护盾BH();

            case GDBuff.Type.无视护盾:return new 无视护盾BH();

            case GDBuff.Type.属性依赖增强:return new 属性依赖增强BH();
            case GDBuff.Type.临时属性变更:return new 临时属性变更BH();
            case GDBuff.Type.回合伤害结算:return new 回合伤害结算BH();
            case GDBuff.Type.回合治疗结算:return new 回合治疗结算BH();

            case GDBuff.Type.属性变更:return new 属性变更BH();
            case GDBuff.Type.属性效率变更:return new 属性效率变更BH();
            case GDBuff.Type.属性偷取:return new 属性偷取BH();

            case GDBuff.Type.出手添加buff:return new 出手添加buffBH();
            case GDBuff.Type.攻击添加buff:return new 攻击添加buffBH();
            case GDBuff.Type.受击添加buff:return new 受击添加buffBH();
            case GDBuff.Type.击杀添加buff:return new 击杀添加buffBH();
            case GDBuff.Type.回合添加buff:return new 回合添加buffBH();
            case GDBuff.Type.死亡添加buff:return new 死亡添加buffBH();
            case GDBuff.Type.闪避添加buff:return new 闪避添加buffBH();
            case GDBuff.Type.复活添加buff:return new 复活添加buffBH();
            case GDBuff.Type.残血添加buff:return new 残血添加buffBH();
            case GDBuff.Type.觉醒添加buff:return new 觉醒添加buffBH();



            case GDBuff.Type.出手移除buff:return new 出手移除buffBH();

            case GDBuff.Type.行动提升系数:return new 行动提升系数BH();

            case GDBuff.Type.英雄觉醒:return new 英雄觉醒BH();
            case GDBuff.Type.觉醒复生:return new 觉醒复生BH();
            case GDBuff.Type.觉醒盾爆:return new 觉醒盾爆BH();
            case GDBuff.Type.觉醒变更:return new 觉醒变更BH();


            case GDBuff.Type.针锋相对:return new 针锋相对BH();


            case GDBuff.Type.沙暴:return new 沙暴BH();
            case GDBuff.Type.焱铠:return new 焱铠BH();
            case GDBuff.Type.复仇之雷:return new 复仇之雷BH();
            case GDBuff.Type.绝对零度:return new 绝对零度BH();


            case GDBuff.Type.星眼:return new 星眼BH();
            case GDBuff.Type.反噬:return new 反噬BH();
            case GDBuff.Type.震伤:return new 震伤BH();
            case GDBuff.Type.战吼:return new 战吼BH();
            case GDBuff.Type.魔化:return new 魔化BH();
            case GDBuff.Type.共免:return new 共免BH();
            case GDBuff.Type.一闪:return new 一闪BH();
            case GDBuff.Type.莲心:return new 莲心BH();
            case GDBuff.Type.酗酒:return new 酗酒BH();
            case GDBuff.Type.追忆:return new 追忆BH();
            case GDBuff.Type.圣光:return new 圣光BH();
            case GDBuff.Type.圣甲:return new 圣甲BH();
            case GDBuff.Type.激荡:return new 激荡BH();
            case GDBuff.Type.霓裳:return new 霓裳BH();
            case GDBuff.Type.余震:return new 余震BH();
            case GDBuff.Type.源泉:return new 源泉BH();
            case GDBuff.Type.复苏:return new 复苏BH();
            case GDBuff.Type.金身:return new 金身BH();
            case GDBuff.Type.悬赏:return new 悬赏BH();
            case GDBuff.Type.寂灭:return new 寂灭BH();
            case GDBuff.Type.风神:return new 风神BH();
            case GDBuff.Type.壁垒:return new 壁垒BH();
            case GDBuff.Type.光焰:return new 光焰BH();
            case GDBuff.Type.暗星:return new 暗星BH();
            case GDBuff.Type.夭折:return new 夭折BH();
            case GDBuff.Type.凋零:return new 凋零BH();
            case GDBuff.Type.无效:return new 无效BH();
            case GDBuff.Type.饱腹:return new 饱腹BH();
            case GDBuff.Type.潜行:return new 潜行BH();
            case GDBuff.Type.封穴:return new 封穴BH();
            case GDBuff.Type.聚气:return new 聚气BH();
            case GDBuff.Type.归元:return new 归元BH();
            case GDBuff.Type.腐蚀:return new 腐蚀BH();
            case GDBuff.Type.虹吸果蝇:return new 虹吸果蝇BH();
            case GDBuff.Type.风神眩晕:return new 风神眩晕BH();
            case GDBuff.Type.真理守护:return new 真理守护BH();
            case GDBuff.Type.觉醒失效:return new 觉醒失效BH();
            case GDBuff.Type.暗影之魂:return new 暗影之魂BH();
            case GDBuff.Type.感同身受:return new 感同身受BH();
            case GDBuff.Type.笔走游龙:return new 笔走游龙BH();
            case GDBuff.Type.暴雨梨花:return new 暴雨梨花BH();
            case GDBuff.Type.水晶印记:return new 水晶印记BH();
            case GDBuff.Type.黄泉梦境:return new 黄泉梦境BH();
            case GDBuff.Type.海神护体:return new 海神护体BH();
            case GDBuff.Type.乾天罡气:return new 乾天罡气BH();
            case GDBuff.Type.四羊奇偶援护:return new 四羊奇偶援护BH();
            default:return new 无效果BH();
        }
    }

}
